package cn.iocoder.yudao.module.mqtt.enums.mqtt;

public enum DataTypeEnum {
    YL("1", "余氯"), // 余氯
    PH("2", "pH值"),
    ZD("3", "浊度"),
    WD ("4", "温度");

    private final String code;
    private final String description; // 中文描述

    DataTypeEnum(String code, String description) {
        this.code = code;
        this.description = description;
    }

    public String getCode() {
        return code;
    }

    public String getDescription() {
        return description;
    }

    public static DataTypeEnum fromCode(String code) {
        for (DataTypeEnum type : DataTypeEnum.values()) {
            if (type.getCode().equals(code)) {
                return type;
            }
        }
        throw new IllegalArgumentException("Unknown data type code: " + code);
    }
}
